<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Registration filter form base class.
 *
 * @package    wifilez
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BaseRegistrationFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'account_id'        => new sfWidgetFormPropelChoice(array('model' => 'Account', 'add_empty' => true)),
      'invoice_id'        => new sfWidgetFormFilterInput(),
      'product_id'        => new sfWidgetFormPropelChoice(array('model' => 'Product', 'add_empty' => true)),
      'quantity'          => new sfWidgetFormFilterInput(),
      'esd_tries'         => new sfWidgetFormFilterInput(),
      'esd_expire'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'order_date'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'vendor_id'         => new sfWidgetFormFilterInput(),
      'vendor_invoice_id' => new sfWidgetFormFilterInput(),
      'collection_used'   => new sfWidgetFormFilterInput(),
      'regcode'           => new sfWidgetFormFilterInput(),
      'force_install'     => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'account_id'        => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Account', 'column' => 'account_id')),
      'invoice_id'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'product_id'        => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Product', 'column' => 'product_id')),
      'quantity'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'esd_tries'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'esd_expire'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'order_date'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'vendor_id'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'vendor_invoice_id' => new sfValidatorPass(array('required' => false)),
      'collection_used'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'regcode'           => new sfValidatorPass(array('required' => false)),
      'force_install'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('registration_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Registration';
  }

  public function getFields()
  {
    return array(
      'registration_id'   => 'Number',
      'account_id'        => 'ForeignKey',
      'invoice_id'        => 'Number',
      'product_id'        => 'ForeignKey',
      'quantity'          => 'Number',
      'esd_tries'         => 'Number',
      'esd_expire'        => 'Date',
      'order_date'        => 'Date',
      'vendor_id'         => 'Number',
      'vendor_invoice_id' => 'Text',
      'collection_used'   => 'Number',
      'regcode'           => 'Text',
      'force_install'     => 'Number',
    );
  }
}
